In communication systems and storage systems, data is typically stored in units such as messages, packets, etc. For instance, communication systems often send data encapsulated in packets. Also, network communication systems often utilize layered communication protocols, such as protocols having a structure similar to the Open Systems Interconnection (OSI) seven layer model. In such communication protocols, at least some of the layers may receive a data unit from the adjacent upper layer and create a new data unit that includes layer-specific information (which may be referred to as a “header” or a “trailer”) appended to the received data unit. For example, the third layer may receive a fourth layer data unit and create a third layer data unit by appending a third layer header to the fourth layer data unit. Similarly, the second layer may receive the third layer data unit and create a second layer data unit by appending a second layer header to the third layer data unit. Eventually, a packet is created for sending over the communications network, and this packet may include headers from several different layers.
The OSI seven layer model includes a physical layer, a data link layer, a network layer, a transport layer, a session layer, a presentation layer, and an application layer. The physical layer is the lowest layer, and handles electrical and physical interaction with a communication medium. The next layer up is the data link layer. The data link layer provides functional and procedural means to transfer data between network entities and to detect and possibly correct errors that may occur in the physical layer. The third layer is the network layer. This layer provides functional and procedural means of transferring variable length data sequences from a source to a destination via one or more networks while maintaining the quality of service requested by a transport layer, which is above the network layer. The fourth layer, the transport layer, provides transparent transfer of data between end users, providing reliable data transfer services to the upper layers. The transport layer may utilize flow control, segmentation/desegmentation, and error control. Some transport layers may keep track of the segments and retransmit those that fail. The session layer controls the dialogues/connections (sessions) between computers. It establishes, manages and terminates the connections between the local and remote application. The presentation layer establishes a context between application layer entities. The presentation layer data units may perform transformations on the data received from an upper layer (examples of such transformations include MPEG compression of video data, encryption of MIME messages, etc.). The application layer interfaces directly to and performs common application services for the application processes.
FIG. 1 is an illustration of an example packet 100 as it may appear on a communication medium of a network. The packet 100 may include an application layer unit including a message 102 and an application layer header 104. The application layer unit may be included within a presentation layer unit that further includes a presentation layer header 108. Similarly, the packet 100 may include multiple nested data units corresponding the various layers in the protocol. As a result, the packet 100 may include multiple headers such as the application layer header 104, the presentation layer header 108, a session layer header 112, a transport layer header 116, a network layer header 120, and a data link layer header 124.
As another example, multiprotocol label switching (MPLS) is a communication protocol for fast packet switching and routing. In the context of the OSI seven layer model, MPLS may be thought of as operating between the second layer, the data link layer, and the third layer, the network layer.
When a data unit, such as the packet 100, is received by a communication device on a network, different processes, modules, etc., may need to operate on different portions of the data unit. For example, with the packet 100, a data link layer process may need to analyze the data link layer header 124, but may ignore the other headers. On the other hand, a transport layer process may need to analyze the transport layer header 116, but may ignore the data link layer header 124, for example. Thus, it is often desirable to parse a received data unit, such as the packet 100, to provide different portions of the data unit to different processes, modules, etc.
With packets, a packet processor is typically used to parse the packet. The parsing of packet data is typically divided into two tasks: analyzing the packet structure and parsing relevant fields based on the packet analysis. Packet analysis requires a previous knowledge of all possible packet types. Currently, organizations such as the Institute of Electrical and Electronics Engineers (IEEE) define packet types and formats. Thus, packet analysis may use such definitions to analyze a packet. The result of packet analysis may include the locations of different headers in the packet. It may also include identification of the protocol that corresponds to each header. This information may be provided to a packet parser which then uses the information to parse the packet.